package dao;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;

public class BaseDao {

	public Connection con;
	public static String url = "jdbc:as400://193.158.21.21:50000/Pub1";
	public static String user="RARC";
	public static String pass="RARC1190";

	public BaseDao() throws ClassNotFoundException{

		Class.forName("com.ibm.as400.access.AS400JDBCDriver");

	}


	public void openConex(){
		try {
			System.out.println("Conectando ..");
			con= DriverManager.getConnection(url, user, pass);
			
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
	}

	public void closeConex(){
		try {
			con.close();
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}

	}


	/**
	 * @return the con
	 */
	public Connection getCon() {
		return con;
	}


	/**
	 * @param con the con to set
	 */
	public void setCon(Connection con) {
		this.con = con;
	}


}
